Imports Microsoft.VisualBasic

Public Class AthletesFootConfigSection
    Inherits ConfigurationSection

    'you can put attributes on methods
    '.net knows if you are getting or setting
    'reflection interrogates a class and returns properties, methods and classes

    <ConfigurationProperty("DefaultConnectionStringName", DefaultValue:="LocalSQLServer")> Public Property DefaultConnectionStringName() As String
        Get
            Return Me("DefaultConnectionStringName").ToString

        End Get
        Set(ByVal value As String)
            Me("DefaultConnectionStringName") = value
        End Set
    End Property
    <ConfigurationProperty("defaultCacheDuration", DefaultValue:="600")> _
       Public Property DefaultCacheDuration() As Integer
        Get
            Return CInt(Me("defaultCacheDuration"))
        End Get
        Set(ByVal value As Integer)
            Me("defaultCacheDuration") = value
        End Set
    End Property
    '    <ConfigurationProperty("events", isrequired:=True)> _
    '   Public ReadOnly Property Events() As EventsElement
    '        Get
    '            Return CType(Me("events"), EventsElement)
    '        End Get
    '    End Property
    '    <ConfigurationProperty("forums", IsRequired:=True)> _
    'Public ReadOnly Property Forums() As ForumsElement
    '        Get
    '            Return CType(Me("forums"), ForumsElement)
    '        End Get
    '    End Property
    <ConfigurationProperty("ContactForm", isrequired:=True)> Public ReadOnly Property ContactForm() As ContactFormElement
        Get
            Return CType(Me("ContactForm"), ContactFormElement)
        End Get
    End Property
    <ConfigurationProperty("sports", isrequired:=True)> _
Public ReadOnly Property Sports() As SportsElement
        Get
            Return CType(Me("sports"), SportsElement)
        End Get
    End Property
    Public Class ContactFormElement
        Inherits ConfigurationElement
        <ConfigurationProperty("MailTo", isrequired:=True)> Public Property MailTo() As String
            Get
                Return Me("MailTo")
            End Get
            Set(ByVal value As String)
                Me("MailTo") = value
            End Set
        End Property
        <ConfigurationProperty("MailCC")> Public Property MailCC() As String
            Get
                Return Me("MailCC")
            End Get
            Set(ByVal value As String)
                Me("MailCC") = value
            End Set
        End Property

    End Class

    Public Class SportsElement
            Inherits ConfigurationElement
            <ConfigurationProperty("connectionStringName")> Public Property ConnectionStringName() As String
                Get
                    Return CStr(Me("connectionStringName"))
                End Get
                Set(ByVal value As String)
                    Me("connectionStringName") = value
                End Set
            End Property
            Public ReadOnly Property ConnectionString() As String

                Get
                    Dim ConnectStringName As String
                    If String.IsNullOrEmpty(Me.ConnectionStringName) Then
                        ConnectStringName = Globals.Settings.DefaultConnectionStringName
                    Else
                        ConnectStringName = Me.ConnectionStringName
                    End If
                    Return ConfigurationManager.ConnectionStrings(ConnectStringName).ConnectionString
                End Get
            End Property
        <ConfigurationProperty("providerType", DefaultValue:="DAL.SQLClient.SQLSportsProvider")> _
            Public Property ProviderType() As String
            Get
                Return CStr(Me("providerType"))
            End Get
            Set(ByVal value As String)
                Me("providerType") = value
            End Set
        End Property
        End Class

        '    Public Class EventsElement
        '        Inherits ConfigurationElement
        '        <ConfigurationProperty("connectionStringName")> Public Property ConnectionStringName() As String
        '            Get
        '                Return CStr(Me("connectionStringName"))
        '            End Get
        '            Set(ByVal value As String)
        '                Me("connectionStringName") = value
        '            End Set
        '        End Property
        '        Public ReadOnly Property ConnectionString() As String

        '            Get
        '                Dim ConnectStringName As String
        '                If String.IsNullOrEmpty(Me.ConnectionStringName) Then
        '                    ConnectStringName = Globals.Settings.DefaultConnectionStringName
        '                Else
        '                    ConnectStringName = Me.ConnectionStringName
        '                End If
        '                Return ConfigurationManager.ConnectionStrings(ConnectStringName).ConnectionString
        '            End Get
        '        End Property
        '        <ConfigurationProperty("providerType", DefaultValue:="TGH.DAL.SQLClient.SQLArticleProvider")> _
        '        Public Property ProviderType() As String
        '            Get
        '                Return CStr(Me("providerType"))
        '            End Get
        '            Set(ByVal value As String)
        '                Me("providerType") = value
        '            End Set
        '        End Property
        '        <ConfigurationProperty("pageSize", DefaultValue:="10")> _
        '        Public Property PageSize() As Integer
        '            Get
        '                Return CInt(Me("pageSize"))
        '            End Get
        '            Set(ByVal value As Integer)
        '                Me("pageSize") = value
        '            End Set
        '        End Property
        '    End Class
        '    <ConfigurationProperty("enableCaching", DefaultValue:=True)> _
        '        Public Property EnableCaching() As Boolean
        '        Get
        '            Return CType(Me("enableCaching"), Boolean)
        '        End Get
        '        Set(ByVal value As Boolean)
        '            Me("enableCaching") = value
        '        End Set
        '    End Property
        '    <ConfigurationProperty("cacheDuration")> _
        '    Public Property CacheDuration() As Integer
        '        Get
        '            Dim duration As Integer = CInt(Me("cacheDuration"))
        '            If duration = 0 Then duration = Globals.Settings.CacheDuration
        '            Return duration
        '        End Get
        '        Set(ByVal value As Integer)
        '            Me("cacheDuration") = value
        '        End Set
        '    End Property

        'End Class
        'Public Class ForumsElement
        '    Inherits ConfigurationElement

        '    <ConfigurationProperty("connectionStringName")> _
        '      Public Property ConnectionStringName() As String
        '        Get
        '            Return CStr(Me("connectionStringName"))
        '        End Get
        '        Set(ByVal value As String)
        '            Me("connectionStringName") = value
        '        End Set
        '    End Property

        '    Public ReadOnly Property ConnectionString() As String
        '        Get
        '            Dim connStringName As String
        '            If String.IsNullOrEmpty(Me.ConnectionStringName) Then
        '                connStringName = Globals.Settings.DefaultConnectionStringName
        '            Else
        '                connStringName = Me.ConnectionStringName
        '            End If
        '            Return ConfigurationManager.ConnectionStrings(connStringName).ConnectionString
        '        End Get
        '    End Property

        '    <ConfigurationProperty("providerType", DefaultValue:="DAL.SqlClient.SqlForumsProvider")> _
        '    Public Property Providertype() As String
        '        Get
        '            Return CStr(Me("providerType"))
        '        End Get
        '        Set(ByVal value As String)
        '            Me("providerType") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("threadsPageSize", DefaultValue:="25")> _
        '    Public Property ThreadsPageSize() As Integer
        '        Get
        '            Return CInt(Me("threadsPageSize"))
        '        End Get
        '        Set(ByVal value As Integer)
        '            Me("threadsPageSize") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("postsPageSize", DefaultValue:="10")> _
        '    Public Property PostsPageSize() As Integer
        '        Get
        '            Return CInt(Me("postsPageSize"))
        '        End Get
        '        Set(ByVal value As Integer)
        '            Me("postsPageSize") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("rssItems", DefaultValue:="5")> _
        '    Public Property RssItems() As Integer
        '        Get
        '            Return CInt(Me("rssItems"))
        '        End Get
        '        Set(ByVal value As Integer)
        '            Me("rssItems") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("hotThreadPosts", DefaultValue:="25")> _
        '    Public Property HotThreadPosts() As Integer
        '        Get
        '            Return CInt(Me("hotThreadPosts"))
        '        End Get
        '        Set(ByVal value As Integer)
        '            Me("hotThreadPosts") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("bronzePosterPosts", DefaultValue:="100")> _
        '    Public Property BronzePosterPosts() As Integer
        '        Get
        '            Return CInt(Me("bronzePosterPosts"))
        '        End Get
        '        Set(ByVal value As Integer)
        '            Me("bronzePosterPosts") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("bronzePosterDescription", DefaultValue:="Bronze Poster")> _
        '    Public Property BronzePosterDescription() As String
        '        Get
        '            Return CStr(Me("bronzePosterDescription"))
        '        End Get
        '        Set(ByVal value As String)
        '            Me("bronzePosterDescription") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("silverPosterPosts", DefaultValue:="500")> _
        '    Public Property SilverPosterPosts() As Integer
        '        Get
        '            Return CInt(Me("silverPosterPosts"))
        '        End Get
        '        Set(ByVal value As Integer)
        '            Me("silverPosterPosts") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("silverPosterDescription", DefaultValue:="Silver Poster")> _
        '    Public Property SilverPosterDescription() As String
        '        Get
        '            Return CStr(Me("silverPosterDescription"))
        '        End Get
        '        Set(ByVal value As String)
        '            Me("silverPosterDescription") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("goldPosterPosts", DefaultValue:="1000")> _
        '    Public Property GoldPosterPosts() As Integer
        '        Get
        '            Return CInt(Me("goldPosterPosts"))
        '        End Get
        '        Set(ByVal value As Integer)
        '            Me("goldPosterPosts") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("goldPosterDescription", DefaultValue:="Gold Poster")> _
        '    Public Property GoldPosterDescription() As String
        '        Get
        '            Return CStr(Me("goldPosterDescription"))
        '        End Get
        '        Set(ByVal value As String)
        '            Me("goldPosterDescription") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("enableCaching", DefaultValue:="true")> _
        '    Public Property EnableCaching() As Boolean
        '        Get
        '            Return CBool(Me("enableCaching"))
        '        End Get
        '        Set(ByVal value As Boolean)
        '            Me("enableCaching") = value
        '        End Set
        '    End Property

        '    <ConfigurationProperty("cacheDuration")> _
        '    Public Property CacheDuration() As Integer
        '        Get
        '            Dim duration As Integer = CInt(Me("cacheDuration"))
        '            If duration > 0 Then
        '                Return duration
        '            Else
        '                Return Globals.Settings.DefaultCacheDuration
        '            End If
        '        End Get
        '        Set(ByVal value As Integer)
        '            Me("cacheDuration") = value
        '        End Set
        '    End Property
        'End Class
    End Class


